/*
 *  process.c
 *
 *  Created on: May 15, 2011
 *  Author: Sergiy Kulyk
 */

#include <stdlib.h>
#include "process.h"


/*******************************************************************
 * 		Request													   *
 ******************************************************************/

/**
 * Request type constructor.
 */
s_request_type_t * s_new_request_type(const int step,
                                      const enum s_request_type_t type) {

    s_request_type_t * request =
        (s_request_type_t *) malloc(sizeof(s_request_type_t));
    if (request) {
        request->step = step;
        request->type = type;
    }
    return request;
}



/*******************************************************************
 * 		Process													   *
 ******************************************************************/

/**
 * Process constructor. Returns a pointer to a new process record, or
 * a null pointer if it was unable to obtain memory for it.
 */
s_process_t * s_new_process(const int steps,
                            const int num_req,
                            s_request_type_t * req_type,
                            enum s_process_type_t p_type) {

    s_process_t * p = NULL;

    p = (s_process_t *) malloc(sizeof(s_process_t));
    if (p) {
        p->num_steps = steps;
        p->num_requests = num_req;
        p->req_type = req_type;
        p->process_type = p_type;
    }
    return p;
}
